package com.shaoshaohuo.app.adapter;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

public class MyBaseAdapter<T> extends BaseAdapter {
    protected List<T> list = new ArrayList<T>();
    protected Context context;
    protected boolean isLoadIcon = true;

    public MyBaseAdapter(Context ctx, List<T> list, boolean flag) {
        this.context = ctx;
        setData(list);
    }

    public void setData(List<T> lst) {
        if (lst != null) {
            list.clear();
            list.addAll(lst);
        }
        notifyDataSetChanged();
    }

    public List<T> getdata() {

        return list;
    }

    public void setLoadIcon(boolean isLoad) {
        this.isLoadIcon = isLoad;
    }

    @Override
    public int getCount() {
        return list == null ? 0 : list.size();
    }

    @Override
    public Object getItem(int arg0) {
        return list.get(arg0);
    }

    @Override
    public long getItemId(int arg0) {
        return arg0;
    }

    @Override
    public View getView(int pos, View view, ViewGroup group) {

        return view;
    }

}
